﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GZSolver
{
  /// <summary>
  /// Matrix encapsulates two-dimensional array.
  /// </summary>
  public class Matrix
  {
    private double[][] array = null;
    private int rowCount = 0;
    private int columnCount = 0;
    /// <summary>
    /// 
    /// </summary>
    /// <param name="m">Number of rows</param>
    /// <param name="n">Number of columns</param>
    public Matrix(int m, int n)
    {
      array = new double[m][];
      for (int i = 0; i < m; i++)
      {
        array[i] = new double[n];
      }
      rowCount = m;
      columnCount = n;
    }

    public double this[int xElement, int yElement]
    {
      get
      {
        return array[xElement][yElement];
      }
      set
      {
        array[xElement][yElement] = value;
      }
    }

    public double[] this[int xElement]
    {
      get
      {
        return array[xElement];
      }
      set
      {
        array[xElement] = value;
      }
    }

    public int RowCount
    {
      get
      {
        return rowCount;
      }
    }

    public int ColumnCount
    {
      get
      {
        return columnCount;
      }
    }
  }
}
